package com.acme.bankapp.domain.bank;

public class CheckingAccount extends AbstractAccount{
	private double overdraft;
	
	public CheckingAccount(double amount, double overdraft) {
		this.balance = amount;
		if (overdraft<0){
			System.out.println("Error creating account (negative overdraft)");
		} else {
			this.setOverdraft(overdraft);
		}

	}
	public boolean withdraw(double amount) {
		if (this.balance >= amount + overdraft){
			this.balance -= amount;
			return true;
		} else {
			System.out.println("Error in method withdraw, class Checking" +
					"Account! (amount has negative value)");
			return false;
		}
	}

	public double getOverdraft() {
		return overdraft;
	}

	public void setOverdraft(double overdraft) {
		this.overdraft = overdraft;
	}
	public double maximumAmountToWithdraw(){
		return (this.balance + this.overdraft);
	}
	
}
